<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/1/15
 * Time: 11:28
 */

namespace app\common\entity;


use think\Model;

class HasMachine extends Model
{
    protected $table = 'has_machine';

    public function updMachineNum($uid, $types)
    {
        switch ($types) {
            case 1:
                $level = 'level1';
                break;
            case 2:
                $level = 'level2';
                break;
            case 3:
                $level = 'level3';
                break;
            case 4:
                $level = 'level4';
                break;
        }
        $ins = self::where('user_id', $uid)->setInc($level,1);
        $upd = self::where('user_id', $uid)->update(['create_time'=>time()]);
        return $ins;
    }
}